# eric7.MicroPython.MicroPythonChartWidget

Module implementing the MicroPython graph widget.

### Global Attributes

None

### Classes

MicroPythonChartWidget | Class implementing the MicroPython graph widget.

### Functions

None

## MicroPythonChartWidget

Class implementing the MicroPython graph widget.

### Signals

dataFlood
  emitted to indicate, that too much data is received

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

MicroPythonChartWidget | Constructor
__addData | Private method to add a tuple of values to the graph.
__eraseData | Private slot to erase the graph and the stored raw data.
__handleMaxXChanged | Private slot handling a change of the max.
hasData | Public method to check, if the chart contains some valid data.
isDirty | Public method to check, if the chart contains unsaved data.
on_saveButton_clicked | Private slot to save the raw data to a CSV file.
preferencesChanged | Public slot to apply changed preferences.
processData | Public slot to process the raw data.
saveData | Public method to save the dialog's raw data.
shutdown | Public method to perform some shutdown actions.

### Static Methods

None

#### MicroPythonChartWidget (Constructor)

MicroPythonChartWidget(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### MicroPythonChartWidget.__addData

__addData(values)

Private method to add a tuple of values to the graph.

It ensures there are the required number of line series, adds the data to the line series and updates the range of the chart so the chart displays nicely.

values (tuple of int or float)
  tuple containing the data to be added

#### MicroPythonChartWidget.__eraseData

__eraseData()

Private slot to erase the graph and the stored raw data.

#### MicroPythonChartWidget.__handleMaxXChanged

__handleMaxXChanged(value)

Private slot handling a change of the max. X spin box.

value (int)
  value of the spin box

#### MicroPythonChartWidget.hasData

hasData()

Public method to check, if the chart contains some valid data.

Return:
  flag indicating valid data

Return Type:
  bool

#### MicroPythonChartWidget.isDirty

isDirty()

Public method to check, if the chart contains unsaved data.

Return:
  flag indicating unsaved data

Return Type:
  bool

#### MicroPythonChartWidget.on_saveButton_clicked

on_saveButton_clicked()

Private slot to save the raw data to a CSV file.

#### MicroPythonChartWidget.preferencesChanged

preferencesChanged()

Public slot to apply changed preferences.

#### MicroPythonChartWidget.processData

processData(data)

Public slot to process the raw data.

It takes raw bytes, checks the data for a valid tuple of ints or floats and adds the data to the graph. If the the length of the bytes data is greater than 1024 then a dataFlood signal is emitted to ensure eric can take action to remain responsive.

data (bytes)
  raw data received from the connected device via the main device widget

#### MicroPythonChartWidget.saveData

saveData()

Public method to save the dialog's raw data.

Return:
  flag indicating success

Return Type:
  bool

#### MicroPythonChartWidget.shutdown

shutdown()

Public method to perform some shutdown actions.

Note: Nothing to do here for this graph widget variant.

Up